package routes

import (
	"api_interface/controller"

	"github.com/gin-gonic/gin"
)

func SetRouter() *gin.Engine {
	r := gin.Default()

	/**
	  提问箱D路由组
	*/

	userGroup := r.Group("api/question_box")
	{
		//获取提问箱的详情信息
		userGroup.GET("/info", controller.Get_box_info())
		//获取用户加入的提问箱
		userGroup.GET("/get_my_join_question_box", controller.Get_user_join_box())
		//获取用户创建的提问箱
		userGroup.GET("/get_my_create_question_box", controller.Get_user_create_box())
		//获取用户管理的提问箱
		userGroup.GET("/get_my_manage_question_box", controller.Get_user_manage_box())
		//获取提问箱的所有成员
		userGroup.GET("/get_member_list", controller.Get_box_member())
		//获取提问箱所有者
		userGroup.GET("/get_owner", controller.GetBoxOwner())
		//修改提问箱成员的管理员权限
		userGroup.PUT("/change_member_admin", controller.ChangeAccountAdminRole())
		//更新提问箱信息
		userGroup.PUT("/update_question_box", controller.Updata_question_box_info())
		//某用户加入某提问箱
		userGroup.POST("/join", controller.Join_box())
		//某用户创建某提问箱
		userGroup.POST("/create", controller.Create_box())
		//将某成员踢出提问箱
		userGroup.DELETE("/remove", controller.Remove_box_member())
		//删除某提问箱
		userGroup.DELETE("/delete", controller.Del_box())
	}

	accountGroup := r.Group("/api/account")
	{
		accountGroup.POST("/login", controller.Login())
		accountGroup.POST("/register", controller.Register())
		accountGroup.GET("/get_info", controller.GetInfo())
		accountGroup.PUT("/modify", controller.Modify())
		accountGroup.GET("/get_concern_info", controller.GetConcernInfo())
		accountGroup.POST("/verify_email", controller.VerifyEmail())
		accountGroup.PUT("/verify_email_code", controller.VerifyEmailAndCode())
		accountGroup.PUT("/reset_pwd", controller.ResetPwd())
		accountGroup.GET("/find_account", controller.FindAccount())
		accountGroup.PUT("/update_email", controller.UpdateEmail())
	}

	//提问路由组
	questionGroup := r.Group("/api/question_info")
	{
		questionGroup.GET("/get_questions_from_box", controller.GetQuesFromBox())
		questionGroup.GET("/search_question", controller.SearchQuesFromBox())
		questionGroup.GET("/get_question_detail", controller.GetQuesById())
		questionGroup.POST("/create_question", controller.CreateQues())
		questionGroup.DELETE("delete_question", controller.DeleteQues())
		questionGroup.PUT("/like", controller.LikeQuesOrDeleteLike())
	}

	//评论路由组
	commentGroup := r.Group("/api/comment_info")
	{
		commentGroup.POST("/add_comment", controller.CreateComment())
		commentGroup.GET("/get_comment", controller.GetComments())
		commentGroup.PUT("/like", controller.LikeCommentOrDeleteLike())
	}

	//回复路由组
	commentReplyGroup := r.Group("/api/comment_reply_info")
	{
		commentReplyGroup.POST("/reply_comment", controller.CreateReply())
		commentReplyGroup.GET("/get_reply", controller.GetReply())

	}

	return r
}
